<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="resource/js/jquery-3.2.1.js"></script>
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
	$(function(){
		$.post(
			"floor",
			function(msg){
				for (var i = 0; i < msg.length; i++) {
					$("[name=floor_id]").append("<option value='"+msg[i].id+"'>"+msg[i].floorNo+"</option>")
				}
			},"json"
		)
		$("[name=floor_id]").change(function(){
			var id=$("[name=floor_id]").val();
			$("[name=dorm_id]").html("");
			$("[name=dorm_id]").append("<option value=''>===请选择===</option>")
			$.post(
					"drom",
					{id:id},
					function(msg){
						for (var i = 0; i < msg.length; i++) {
							$("[name=dorm_id]").append("<option value='"+msg[i].id+"'>"+msg[i].dromNo+"</option>")
						}
					},"json"
				)
		})
	})
	function tj(){
		location.href="update?name="+name+"&id="+dorm_id;
	}
</script>
<form action="">
	学生<select name="name">
	<c:forEach items="${list }" var="c">
		<option value="${c.id }">${c.name }</option>
	</c:forEach>
	</select><br>
	楼号<select name="floor_id">
		<option value="">===请选择===</option>
	</select><br>
	宿舍号<select name="dorm_id">
		
	</select><br>
	<input type="button" onclick="tj()" value="提交">
</form>
</body>
</html>